# Contributor: Joonas Kuorilehto <oss@derbian.fi>
# Maintainer: Joonas Kuorilehto <oss@derbian.fi>
pkgname=ruuvi-prometheus
pkgver=0.1.7
pkgrel=5
pkgdesc="Ruuvi sensor Prometheus exporter"
url="https://github.com/joneskoo/ruuvi-prometheus"
license="BSD-2-Clause"
arch="all !riscv64" # prometheus cpuinfo doesnt support riscv64
options="!check" # no test suite
depends="bluez"
makedepends="go"
subpackages="$pkgname-openrc"

source="$pkgname-$pkgver.tar.gz::https://github.com/joneskoo/ruuvi-prometheus/archive/v$pkgver.tar.gz
	ruuvi-prometheus.initd
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -ldflags="-X main.version=$pkgver"
}

package() {
	install -Dm755 ./ruuvi-prometheus "$pkgdir"/usr/bin/ruuvi-prometheus
	install -Dm755 "$srcdir"/ruuvi-prometheus.initd "$pkgdir"/etc/init.d/ruuvi-prometheus
}

sha512sums="
97a8d8d3f81391746038cda319686d4c3b5da4b138e1e9b2bc9459007d6e4676a8e58531dbbc69b2f0c4691c3f71c25257714944fe03e5580e140c4d20768687  ruuvi-prometheus-0.1.7.tar.gz
6eb05b76ea6289799f37a0e0d42e663d6bd013b46468126cb2ac3c90bfd3421db7044895d49e059e32e9d3f5e870343b494ab455f2164727b111b647af107d61  ruuvi-prometheus.initd
"
